home *** CD-ROM | disk | FTP | other *** search
/ EnigmA Amiga Run 1995 November / EnigmA AMIGA RUN 02 (1995)(G.R. Edizioni)(IT)[!][issue 1995-11][Skylink CD].iso / earcd / gfx / jpegaga2.lha / jpegAGAsrc / ppm2aga / ASLScreenMode.c next >
C/C++ Source or Header  |  1994-09-28  |  2KB  |  79 lines

  1. /* Display an ASL screenmode requester */
  2.  
  3. #include <exec/types.h>
  4. #include <libraries/asl.h>
  5. #include <utility/tagitem.h>
  6. #include "ppm2AGA.h"
  7.  
  8. #define SMRTITLE ("Select a screen mode")
  9.  
  10. extern ULONG SMR_DisplayID;
  11. extern ULONG SMR_NumPlanes;
  12. extern ULONG SMR_HAM;
  13.  
  14. struct Library *AslBase;
  15. extern struct Library *GfxBase;
  16.  
  17. struct TagItem smrtags[] = 
  18. { { ASLSM_TitleText, SMRTITLE },
  19.   { ASLSM_DoDepth, TRUE },
  20.   { ASLSM_PropertyFlags, DIPF_IS_AA }, 
  21.   { ASLSM_PropertyMask, DIPF_IS_DUALPF | DIPF_IS_EXTRAHALFBRITE}, 
  22.   { TAG_DONE, 0 }
  23. };
  24.  
  25. int ChooseScreenMode()
  26. {
  27.   struct ScreenModeRequester *smr;
  28.   int ASL_failure=0;
  29.  
  30.   if( AslBase=OpenLibrary("asl.library", 38L) )
  31.   {
  32.     if(AslBase->lib_Version == 38) smrtags[2].ti_Data = DIPF_IS_ECS;
  33.  
  34.     if( smr = (struct ScreenModeRequester *)
  35.         AllocAslRequest(ASL_ScreenModeRequest, smrtags) )
  36.     {
  37.       if( AslRequest(smr, 0L) )
  38.       {
  39.         struct DisplayInfo queryinfo;
  40.  
  41.         /* printf("Display type: $%lx\n", smr->sm_DisplayID); */
  42.         SMR_DisplayID = smr->sm_DisplayID;
  43.         /* printf("Num planes: %ld\n", smr->sm_DisplayDepth); */
  44.         SMR_NumPlanes = smr->sm_DisplayDepth;
  45.  
  46.         if(GetDisplayInfoData(NULL, (UBYTE *)&queryinfo, sizeof(queryinfo),DTAG_DISP,SMR_DisplayID))
  47.         {
  48.           if(queryinfo.PropertyFlags)
  49.           {
  50.             if(queryinfo.PropertyFlags & DIPF_IS_HAM)
  51.               SMR_HAM = 1;
  52.             else SMR_HAM = 0;
  53.  
  54.             /* if(SMR_HAM) printf("Mode is HAM\n"); */
  55.            }
  56.            else ASL_failure = 1;
  57.         }
  58.         else ASL_failure = 1;
  59.  
  60.       }
  61.       else
  62.       {
  63.         /* printf("User cancelled or error...\n"); */
  64.         ASL_failure=1;
  65.       }
  66.  
  67.       FreeAslRequest(smr);
  68.     }
  69.     CloseLibrary(AslBase);
  70.     if(!ASL_failure)
  71.       return 0;
  72.     else
  73.       return 1;
  74.    }
  75.    pm_message("Could not open asl.library V38 or higher.\n");
  76.    return 1;
  77. }
  78.  
  79.